//-----------------------------------------------------------------------
// <copyright file="HelpService.cs" company="FetCo">
//     Copyright (c) FetCo. All rights reserved.
// </copyright>
//-----------------------------------------------------------------------	

using System;
using System.Collections;
using FetCo.Framework;
using ADESSA.Entities;
using ADESSA.Data;
    
namespace ADESSA.Business
{   
	/// <summary>
	/// 
	/// </summary> 
    public class HelpService
    {
        #region Help

        public static void CreateHelp(Help help)
        {            
            try
            {
                HelpDAO helpDAO = new HelpDAO();
                helpDAO.CreateHelp(help);
            }
            catch (BusinessException)
            {
                throw;
            }
            catch (Exception ex)
            {
                // log this exception
                Logger.Error(ex);
                // wrap it and rethrow
                throw new BusinessException(SR.BusinessCreateHelpException, ex);
            }
        }        

        public static void UpdateHelp(Help help)
        {            
            try
            {
                HelpDAO helpDAO = new HelpDAO();
                helpDAO.UpdateHelp(help);
            }
            catch (BusinessException)
            {
                throw;
            }
            catch (Exception ex)
            {
                // log this exception
                Logger.Error(ex);
                // wrap it and rethrow
                throw new BusinessException(SR.BusinessUpdateHelpException, ex);
            }
        }        

        public static void DeleteHelp(long helpId)
        {            
            try
            {
                HelpDAO helpDAO = new HelpDAO();
                helpDAO.DeleteHelp(helpId);
            }
            catch (BusinessException)
            {
                throw;
            }
            catch (Exception ex)
            {
                // log this exception
                Logger.Error(ex);
                // wrap it and rethrow
                throw new BusinessException(SR.BusinessDeleteHelpException, ex);
            }
        }
        
        public static Help GetHelp(long helpId)
        {            
            try
            {
                HelpDAO helpDAO = new HelpDAO();
                return helpDAO.GetHelp(helpId);                
            }
            catch (BusinessException)
            {
                throw;
            }
            catch (Exception ex)
            {
                // log this exception
                Logger.Error(ex);
                // wrap it and rethrow
                throw new BusinessException(SR.BusinessGetHelpException, ex);
            }
        }                

        public static HelpCollection GetHelpList(HelpColumns orderBy, OrderDirection orderDirection)
        {            
            try
            {
                HelpDAO helpDAO = new HelpDAO();
                return helpDAO.GetHelpList(orderBy, orderDirection);
            }
            catch (BusinessException)
            {
                throw;
            }
            catch (Exception ex)
            {
                // log this exception
                Logger.Error(ex);
                // wrap it and rethrow
                throw new BusinessException(SR.BusinessGetHelpListException, ex);
            }
        }        

        public static HelpCollection GetHelpList(HelpColumns orderBy, OrderDirection orderDirection, int page, int pageSize, out int totalRecords)
        {            
            try
            {
                HelpDAO helpDAO = new HelpDAO();
                return helpDAO.GetHelpList(orderBy, orderDirection, page, pageSize, out totalRecords);
            }
            catch (BusinessException)
            {
                throw;
            }
            catch (Exception ex)
            {
                // log this exception
                Logger.Error(ex);
                // wrap it and rethrow
                throw new BusinessException(SR.BusinessGetHelpListException, ex);
            }
        }        

	    public static HelpCollection GetHelpListByParam(object orderBy, OrderDirection orderDirection,string where)
        {            
            try
            {
                HelpDAO helpDAO = new HelpDAO();
                return helpDAO.GetHelpListByParam(orderBy, orderDirection,where);
            }
            catch (BusinessException)
            {
                throw;
            }
            catch (Exception ex)
            {
                // log this exception
                Logger.Error(ex);
                // wrap it and rethrow
                throw new BusinessException(SR.BusinessGetHelpListException, ex);
            }
        }        

        public static HelpCollection GetHelpListByParam(object orderBy, OrderDirection orderDirection, int page, int pageSize,string Criteria, out int totalRecords)
        {            
            try
            {
                HelpDAO helpDAO = new HelpDAO();
                return helpDAO.GetHelpListByParam(orderBy, orderDirection, page, pageSize,Criteria, out totalRecords);
            }
            catch (BusinessException)
            {
                throw;
            }
            catch (Exception ex)
            {
                // log this exception
                Logger.Error(ex);
                // wrap it and rethrow
                throw new BusinessException(SR.BusinessGetHelpListException, ex);
            }
        }        

        #endregion
    }
}